﻿cms.date = function () {

    function _getRoundedDate(date, mode, significance, step) {
        // mode: how should the date be rounded? auto/up/down
        // significance: hour, minute
        // step: what should the datetime be rounded to? 
        // As of now, this function only rounds up to the nearest 5-min.
        var minutes = date.getMinutes();
        var diff = minutes % step;
        var adjustedMinutes = ((((minutes - diff) / step) + 1) * step);
        date.setMinutes(adjustedMinutes);
        return date;
    }

    return {
        getRoundedDate: _getRoundedDate
    }

} ();
